TABLE.IN_USE Function
Syntax
Arguments
- file
The name of a file.
- physical_file_only
Optional. Default = .F. .T. = If the table you are testing is a shadow table, and you want to be sure that no other user has opened the master table (either directly, or indirectly, through the use of a shadow table). .F. = Alpha Anywhere will check only that no other user has the shadow table file in use
Description
Returns true if the named table/library is in use (does exclusive open test).
Discussion
The TABLE.IN_USE() method returns .T. if Filename is currently in use in any session. This function is useful for determining if Alpha Anywhere can get exclusive use of a file before attempting to perform an operation on a file that requires exclusive access.
Example
This PC has the customer shadow table open. The example shows that no other users have the customer table open.
? table.in_use("customer.dbf", .t.) = .F.
This script tests if it can get exclusive access to invoice_items. If so, it compacts the table.
file = "c:\program files\a5v5\invoice\invoice_items.dbf" test = table.in_use(file) if (.not. test) then table.compact(file) else ui_msg_box("Error","File is in use.") end if
See Also